cmake_minimum_required(VERSION 3.10)
project(StudentManagementSystem VERSION 1.0)

# 设置 C++ 标准
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 设置项目使用 UTF-8 编码
if(MSVC)
    # Windows + MSVC：使用 /utf-8 选项
    add_compile_options(/utf-8)
else()
    # GCC / Clang：通过预定义宏和源文件假设为 UTF-8
    add_compile_options(-finput-charset=UTF-8 -fexec-charset=UTF-8)
endif()

# 添加包含目录
include_directories(${PROJECT_SOURCE_DIR}/)

# 获取源文件
file(GLOB SOURCES 
    "${PROJECT_SOURCE_DIR}/*.cpp"
    "${PROJECT_SOURCE_DIR}/*.h"
)

# 创建可执行文件
add_executable(${PROJECT_NAME} ${SOURCES})

# 设置输出目录
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)

# 如果是 Windows，设置输出目录为可执行文件同级目录
if(WIN32)
    set_target_properties(${PROJECT_NAME} PROPERTIES
        RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin
        RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/bin
        RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/bin
    )
endif() 